*install required stata packages (commented out but run these from the command line or uncomment)
*ssc install cibar
*ssc install estout
*net install gr0002_3.pkg, from(http://www.stata-journal.com/software/sj4-3)

clear
*change to your working directory
*cd "YOUR FILE PATH HERE"

*inside the working directory above, make sure there is a folder called Figures and one called Tables

capture log close
log using "stata-output-log.tex", text replace

*get pilot data ready to merge
use "experiments-pilot-data-2021.dta"
recast str244 Q832
drop if Q832==""
duplicates drop Q832, force
save "experiments-pilot-data-2021-recast.dta", replace

*append together master data
use "experiments-2021-representative.dta", clear

*partisan distribution of rep sample without soft launch data
preserve
drop if StartDate<tc(08may2021 09:38:00) 
gen democrat=(Q778==2 | Q782==2)
tab democrat 
restore

append using "experiments-2021-democrats.dta"
append using "experiments-2021-republicans.dta"
save "experiments-2021-combined.dta", replace
count

*make CSV of repeats
preserve
duplicates drop Q832, force
recast str244 Q832
merge 1:1 Q832 using "experiments-pilot-data-2021-recast.dta"
tab _merge
keep if _merge==3
outsheet Q832 using "pilot-repeats.csv", comma replace
restore

*drop test responses
drop if StartDate<tc(07may2021 23:05:01) 
count

*The survey will be terminated for those who answer “No” for the consent question or “Under 18” for the age question. 

*all consent
tab Q763

*no one under 18
tab Q808

*We will not include pure independents in our analysis (i.e., those who do not lean toward either party) as they are not susceptible to affective polarization on a partisan basis. 

*drops 122 pure independents
drop if Q782==3
count

*The survey will also be terminated for respondents who fail both pre-treatment attention checks or twice fail to accurately answer questions testing their understanding of the trust game. 

*56 drops for failing both pre-treatment attention checks
drop if errors1==1 & errors3==3
count 

*drops 341 for failing to answer the instructions questions correctly on either try
keep if (Q893==3 & Q895==6) | (Q898==5 & Q899==6)
count

**We will also exclude people from our analysis who do not report using any form of social media (Facebook, Twitter, Snapchat, Instagram, WhatsApp, and Other) and who also say they would not share any type of news electronically with friends or family members.

gen prereg_include_social=(SocialMedia_1==1 | SocialMedia_2==1 | SocialMedia_3==1 | SocialMedia_4==1 | SocialMedia_5==1 | SocialMedia_6==1 | Q963_1==1 | Q963_2==1 | Q963_3==1 | Q963_4==1 | Q963_5==1 | Q963_6==1) 

*excludes 16
tab prereg_include_social

gen deviation_twfb_political=(SocialMedia_1==1 | SocialMedia_2==1) & SharingType_1==1

*excludes 1194
tab deviation_twfb_political

gen deviation_social_political=(SocialMedia_1==1 | SocialMedia_2==1 | SocialMedia_3==1 | SocialMedia_4==1 | SocialMedia_5==1 | SocialMedia_6==1) & SharingType_1==1

*excludes 1135
tab deviation_social_political

*only 59 different, skip robustness test for deviation_social_political
tab deviation_twfb_political deviation_social_political

*keep people who made it to the experiment

*14 observations deleted for not getting there
keep if Q996_Page_Submit!=. 
count 

*remove second time this participant took it
drop if StartDate==tc(10may2021 23:06:43) & Q832=="5f4c9e74da9c148b0d42ecbd"

*participants who took part in a pretest are ineligible - drop 77
recast str244 Q832
merge 1:1 Q832 using "experiments-pilot-data-2021-recast.dta"
tab _merge
keep if _merge==1
drop _merge

count

/*The primary dependent variable is likelihood that respondents will share a given headline. After presenting each headline, we ask the question, "If you were to see the above on social media, how likely would you be to share it?" Respondents are given six options: "Extremely likely" (6), "Moderately likely" (5), "Slightly likely" (4), "Slightly unlikely" (3), "Moderately unlikely" (2), "Extremely unlikely" (1). We will compute mean intention to share these headlines by respondent for true headlines (mean_share_true), false headlines (mean_share_false), and the difference between them (mean_share_diff; i.e., mean_share_true-mean_share_false) both overall and separately for those headlines that are congenial and uncongenial to a respondent.*/

*a. Trump Holds Bible Upside Down And Backwards During Press Conference, Enraging Bishop And The Nation (false, congenial to Democrats) 

gen TrumpBible=Q1836
recode TrumpBible (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*b. Biden: 'A Black Man Invented the Lightbulb, Not a White Guy Named Edison' (false, congenial to Democrats) 

gen BidenBulb=Q1839
recode BidenBulb (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*NOT THIS: c. Report: Trump Responsible for All Covid Deaths (false, congenial to Democrats) 
*deviation - actually USPS Reportedly Failed to Deliver 27 Percent of Mail-in Ballots in South Florida

gen FloridaBallots=Q1842
recode FloridaBallots (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*d. D.C. Passes Bill to Immunize Children Without Parental Knowledge, Consent (false, congenial to Republicans) 

gen KidVax=Q1845
recode KidVax (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*e. Report: Biden Admin May Use Private Firms to Spy on Unsuspecting Americans (false, congenial to Republicans) 

gen BidenSpy=Q1848
recode BidenSpy (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*f. ANTIFA members implicated in Oregon wildfires (false, congenial to Republicans)

gen AntifaFire=Q1851
recode AntifaFire (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*g. EXCLUSIVE: Fox News Passed on Hunter Biden Laptop Story Over Credibility Concerns (true, congenial to Democrats) 

gen FoxPassed=Q1854
recode FoxPassed (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*h. Federal judges increase oversight of USPS to ensure ballots delivered on time (true, congenial to Democrats) 

gen PostalOversight=Q1857
recode PostalOversight (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*i. Michigan Governor accuses Trump of encouraging 'sick and depraved men' in kidnapping plot (true, congenial to Democrats) 

gen MichiganPlot=Q1860
recode MichiganPlot (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*j. Democrats, trying everything, fail to derail Amy Coney Barrett confirmation (true, congenial to Republicans) 

gen BarrettNom=Q1863
recode BarrettNom (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*k. GOP Congressman: We Need The Senate To Investigate Hunter Biden (true, congenial to Republicans)

gen InvestigateHunter=Q1866
recode InvestigateHunter (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*l. Trump's gains among Latino voters shouldn't come as a surprise. Here's why. (true, congenial to Republicans) 

gen TrumpGains=Q1869
recode TrumpGains (1=6) (2=5) (3=4) (5=3) (6=2) (7=1)

*drop the person with 1 answer
egen totalshare=rowtotal(FoxPassed PostalOversight MichiganPlot BarrettNom InvestigateHunter TrumpGains TrumpBible FloridaBallots KidVax BidenSpy AntifaFire)
drop if totalshare==4

*deviation - exclude Biden light bulb headline
egen mean_share_true=rowmean(FoxPassed PostalOversight MichiganPlot BarrettNom InvestigateHunter TrumpGains)
egen mean_share_false=rowmean(TrumpBible FloridaBallots KidVax BidenSpy AntifaFire)
gen mean_share_diff=mean_share_true-mean_share_false

*robustness - alt versions excluding DC and spying
egen mean_share_false_alt=rowmean(TrumpBible FloridaBallots AntifaFire)
gen mean_share_diff_alt=mean_share_true-mean_share_false_alt
pwcorr mean_share_false mean_share_false_alt
pwcorr mean_share_diff mean_share_diff_alt

*code party for congenial/uncongenial DVs
gen democrat=(Q778==2 | Q782==2)
gen republican=(Q778==1 | Q782==1)

gen mean_share_true_congenial=.
egen mean_share_true_congenial_rep=rowmean(BarrettNom InvestigateHunter TrumpGains)
egen mean_share_true_congenial_dem=rowmean(FoxPassed PostalOversight MichiganPlot)
replace mean_share_true_congenial=mean_share_true_congenial_rep if republican==1
replace mean_share_true_congenial=mean_share_true_congenial_dem if democrat==1

gen mean_share_false_congenial=.
egen mean_share_false_congenial_rep=rowmean(KidVax BidenSpy AntifaFire)
egen mean_share_false_congenial_dem=rowmean(TrumpBible FloridaBallots)
replace mean_share_false_congenial=mean_share_false_congenial_rep if republican==1
replace mean_share_false_congenial=mean_share_false_congenial_dem if democrat==1

gen mean_share_false_congenial_alt=.
egen mean_share_false_congenial_ar=rowmean(AntifaFire)
egen mean_share_false_congenial_ad=rowmean(TrumpBible FloridaBallots)
replace mean_share_false_congenial_alt=mean_share_false_congenial_ar if republican==1
replace mean_share_false_congenial_alt=mean_share_false_congenial_ad if democrat==1

gen mean_share_diff_congenial=mean_share_true_congenial-mean_share_false_congenial
gen mean_share_diff_congenial_alt=mean_share_true_congenial-mean_share_false_congenial_alt

gen mean_share_true_uncongenial=.
egen mean_share_true_uncongenial_dem=rowmean(BarrettNom InvestigateHunter TrumpGains)
egen mean_share_true_uncongenial_rep=rowmean(FoxPassed PostalOversight MichiganPlot)
replace mean_share_true_uncongenial=mean_share_true_uncongenial_rep if republican==1
replace mean_share_true_uncongenial=mean_share_true_uncongenial_dem if democrat==1

gen mean_share_false_uncongenial=.
egen mean_share_false_uncongenial_dem=rowmean(KidVax BidenSpy AntifaFire)
egen mean_share_false_uncongenial_rep=rowmean(TrumpBible FloridaBallots)
replace mean_share_false_uncongenial=mean_share_false_uncongenial_rep if republican==1
replace mean_share_false_uncongenial=mean_share_false_uncongenial_dem if democrat==1

gen mean_share_false_uncongenial_alt=.
egen mean_share_false_uncongenial_ad=rowmean(AntifaFire)
egen mean_share_false_uncongenial_ar=rowmean(TrumpBible FloridaBallots)
replace mean_share_false_uncongenial_alt=mean_share_false_uncongenial_ar if republican==1
replace mean_share_false_uncongenial_alt=mean_share_false_uncongenial_ad if democrat==1

gen mean_share_diff_uncongenial=mean_share_true_uncongenial-mean_share_false_uncongenial
gen mean_share_diff_uncongenial_alt=mean_share_true_uncongenial-mean_share_false_uncongenial_alt

/*
We will calculate two measures of affective polarization from these responses (treating leaners as partisans): 
-Feelings toward people who are members of the respondent's party minus feelings toward people who are members of the other party 
-Feelings toward politicians and elected officials who are members of the respondent's party minus feelings toward politicians and elected officials who are members of the other party
*/

gen affpol_people=Q908_3-Q908_2

gen affpol_pols=Q908_6-Q908_5

su affpol*

/*
Participants are asked the following: How important is it to you that you only share news articles on social media (such as Facebook and Twitter) if they are accurate? 
-Slightly important (1) 
-Moderately important (2) 
-Very important (3) 
-Extremely important (4) 
*/

*TYPO IN PREREG, MAKING 1-5

gen acc_imp=Q831
recode acc_imp (7=5) (6=4) (5=3) (4=2)
tab acc_imp

*Accuracy nudge: 1 if randomized to accuracy nudge condition, 0 otherwise 

gen nudge=.
replace nudge=0 if Condition=="PositiveNoNudge" | Condition=="NegativeNoNudge"
replace nudge=1 if Condition=="NegativeNudge" | Condition=="PositiveNudge"

tab nudge

*Affective polarization manipulation: 0 if randomized to negative experience condition, 1 if assigned to positive experience condition REVISED 9/20/21 per Broockman/Kalla/Westwood

gen affpol=.
replace affpol=0 if Condition=="NegativeNudge" | Condition=="NegativeNoNudge"
replace affpol=1 if Condition=="PositiveNudge" | Condition=="PositiveNoNudge"

tab affpol
tab affpol nudge

/*
Respondents will be asked a series of questions about their "need for chaos" using a battery from Petersen, Osmundsen, and Arceneaux (2020). We will compute the following measures: 
-nfc_mean = mean of answers on 0-6 NFC scale 
-nfc_tercile = tercile of respondent's nfc_mean
*/

forval i=1/8 {
gen nfc`i'=Q795_`i'
recode nfc`i' (13=6) (14=5) (15=4) (16=3) (17=2) (18=1) (19=0)
}

egen nfc_mean=rowmean(nfc*)
su nfc*

xtile nfc_tercile=nfc_mean, nq(3)
bysort nfc_tercile: su nfc_mean

gen medium_nfc=(nfc_tercile==2)
gen high_nfc=(nfc_tercile==3)

*Strength of party identity will be measured with indicators for not very strong and strong partisans (leaners are the omitted category). 

gen not_strong_partisan=(Q784==2 | Q786==2) 
gen strong_partisan=(Q784==1 | Q786==1)

tab not_strong_partisan strong_partisan /*40% not strong, 49% strong, 11% lean*/

/*
To improve efficiency, all statistical models will include the following measures ("controls"): 
-male (identify as male = 1, other = 0) 
-nonwhite (identify as black/AAPI/Native/Multi-racial/Hispanic = 1, other = 0) 
-college (less than hs = 0, hs diploma = 0, some college = 0, associates = 0, bachelors = 1, master's = 1, professional/doctorate = 1) 
-biden_approve (strongly/somewhat disapprove = 0, somewhat/strongly approve = 1) -democrat (identify as Democrat or lean Democrat = 1, other = 0) 
-republican (identify as Republican or lean Republican = 1, other = 0) 
-age (indicators for 35-44, 45-54, 55-64, and 65+; 18-34 omitted) 
-indicators for self-reported usage of Facebook, Twitter, Instagram, Whatsapp, Snapchat 
-indicators for self-reported sharing of science/technology news, celebrity news, business news, political news, and sports news on social media 
*/

gen male=(Q768==1) if Q768!=.

gen nonwhite=(Q770_2==1 | Q770_3==1 | Q770_4==1 | Q770_5==1 | Q772==1)

gen college=Q776>4 if Q776!=.

gen biden_approve=Q792<3 if Q792!=.

gen age3544=(Q808==4) if Q808!=. 
gen age4554=(Q808==5) if Q808!=. 
gen age5564=(Q808==6) if Q808!=. 
gen age65plus=(Q808>6) if Q808!=. 

gen agegroup=.
replace agegroup=1 if Q808<4
replace agegroup=2 if Q808==4
replace agegroup=3 if Q808==5
replace agegroup=4 if Q808==6
replace agegroup=5 if age65plus==1

gen use_fb=(SocialMedia_1==1)
gen use_tw=(SocialMedia_2==1)
gen use_snap=(SocialMedia_3==1)
gen use_insta=(SocialMedia_4==1)
gen use_wa=(SocialMedia_5==1)

egen total_social=rowtotal(use_*)
gen total_social_binary=(total_social>0) 

gen share_pol=(SharingType_1==1) 
gen share_sports=(SharingType_2==1)
gen share_celeb=(SharingType_3==1)
gen share_science=(SharingType_4==1)
gen share_biz=(SharingType_5==1)

egen total_share=rowtotal(share_*)
gen total_share_binary=(total_share>0)

*descriptives

preserve

keep if deviation_twfb_political==1
count

tab male 
tab college 
tab agegroup
tab democrat 
tab republican 
tab biden_approve
tab nonwhite
restore

*make sample balance table

gen treatment=.
replace treatment=1 if nudge==0 & affpol==0
replace treatment=2 if nudge==1 & affpol==0
replace treatment=3 if nudge==0 & affpol==1
replace treatment=4 if nudge==1 & affpol==1

putexcel set balance, replace
putexcel B1=("Baseline") C1=("Nudge") D1=("Affective polarization") E1=("Nudge x polarization") F1=("Total")

gen fakewt=1 /*fake survey weights*/
svyset [pweight=fakewt] /*more convenient for output of proportions*/

/*gender marginals*/
putexcel A2=("Gender") A3=("Male") A4=("Female/other")

tab male treatment if deviation_twfb_political==1, chi

svy, subpop(if deviation_twfb_political==1): tab male if nudge==0 & affpol==0
matrix GenderBaseline = e(b)'
putexcel B3=matrix(GenderBaseline)

svy, subpop(if deviation_twfb_political==1): tab male if nudge==1 & affpol==0
matrix GenderNudge = e(b)'
putexcel C3=matrix(GenderNudge)

svy, subpop(if deviation_twfb_political==1): tab male if nudge==0 & affpol==1
matrix GenderAffpol = e(b)'
putexcel D3=matrix(GenderAffpol)

svy, subpop(if deviation_twfb_political==1): tab male if nudge==1 & affpol==1
matrix GenderNudgeAffpol = e(b)'
putexcel E3=matrix(GenderNudgeAffpol)

svy, subpop(if deviation_twfb_political==1): tab male 
matrix GenderTotal = e(b)'
putexcel F3=matrix(GenderTotal)

/*education marginals*/
putexcel A6=("Education") A7=("Less than a bachelor's") A8=("College graduate")

tab college treatment if deviation_twfb_political==1, chi

svy, subpop(if deviation_twfb_political==1): tab college if nudge==0 & affpol==0
matrix CollegeBaseline = e(b)'
putexcel B7=matrix(CollegeBaseline)

svy, subpop(if deviation_twfb_political==1): tab college if nudge==1 & affpol==0
matrix CollegeNudge = e(b)'
putexcel C7=matrix(CollegeNudge)

svy, subpop(if deviation_twfb_political==1): tab college if nudge==0 & affpol==1
matrix CollegeAffpol = e(b)'
putexcel D7=matrix(CollegeAffpol)

svy, subpop(if deviation_twfb_political==1): tab college if nudge==1 & affpol==1
matrix CollegeNudgeAffpol = e(b)'
putexcel E7=matrix(CollegeNudgeAffpol)

svy, subpop(if deviation_twfb_political==1): tab college 
matrix CollegeTotal = e(b)'
putexcel F7=matrix(CollegeTotal)

/*race marginals*/
putexcel A10=("Race/ethnicity") A11=("White") A12=("Non-white")

tab nonwhite treatment if deviation_twfb_political==1, chi

svy, subpop(if deviation_twfb_political==1): tab nonwhite if nudge==0 & affpol==0
matrix nonwhiteBaseline = e(b)'
putexcel B11=matrix(nonwhiteBaseline)

svy, subpop(if deviation_twfb_political==1): tab nonwhite if nudge==1 & affpol==0
matrix nonwhiteNudge = e(b)'
putexcel C11=matrix(nonwhiteNudge)

svy, subpop(if deviation_twfb_political==1): tab nonwhite if nudge==0 & affpol==1
matrix nonwhiteAffpol = e(b)'
putexcel D11=matrix(nonwhiteAffpol)

svy, subpop(if deviation_twfb_political==1): tab nonwhite if nudge==1 & affpol==1
matrix nonwhiteNudgeAffpol = e(b)'
putexcel E11=matrix(nonwhiteNudgeAffpol)

svy, subpop(if deviation_twfb_political==1): tab nonwhite 
matrix nonwhiteTotal = e(b)'
putexcel F11=matrix(nonwhiteTotal)

/*age marginals*/
putexcel A14=("Age") A15=("18-34") A16=("35-44") A17=("45-54") A18=("55-64") A19=("65+")

tab agegroup treatment if deviation_twfb_political==1, chi

svy, subpop(if deviation_twfb_political==1): tab agegroup if nudge==0 & affpol==0
matrix agegroupBaseline = e(b)'
putexcel B15=matrix(agegroupBaseline)

svy, subpop(if deviation_twfb_political==1): tab agegroup if nudge==1 & affpol==0
matrix agegroupNudge = e(b)'
putexcel C15=matrix(agegroupNudge)

svy, subpop(if deviation_twfb_political==1): tab agegroup if nudge==0 & affpol==1
matrix agegroupAffpol = e(b)'
putexcel D15=matrix(agegroupAffpol)

svy, subpop(if deviation_twfb_political==1): tab agegroup if nudge==1 & affpol==1
matrix agegroupNudgeAffpol = e(b)'
putexcel E15=matrix(agegroupNudgeAffpol)

tab agegroup 
matrix agegroupTotal = e(b)'
putexcel F15=matrix(agegroupTotal)

/*party marginals*/
putexcel A21=("Party") A22=("Democrat") A23=("Republican")

tab republican treatment if deviation_twfb_political==1, chi

svy, subpop(if deviation_twfb_political==1): tab republican if nudge==0 & affpol==0
matrix PartyBaseline = e(b)'
putexcel B22=matrix(PartyBaseline)

svy, subpop(if deviation_twfb_political==1): tab republican if nudge==1 & affpol==0
matrix PartyNudge = e(b)'
putexcel C22=matrix(PartyNudge)

svy, subpop(if deviation_twfb_political==1): tab republican if nudge==0 & affpol==1
matrix PartyAffpol = e(b)'
putexcel D22=matrix(PartyAffpol)

svy, subpop(if deviation_twfb_political==1): tab republican if nudge==1 & affpol==1
matrix PartyNudgeAffpol = e(b)'
putexcel E22=matrix(PartyNudgeAffpol)

svy, subpop(if deviation_twfb_political==1): tab republican 
matrix PartyTotal = e(b)'
putexcel F22=matrix(PartyTotal)

*We will compute the treatment effects via OLS with robust standard errors. 

/*
To test H1 and H2a, we will estimate a model of the form 

Y = b0 + b1*nudge + b2*polarization + controls 

at the respondent level where the outcome variable is mean_share_diff. (We may also report separate results for mean_share_true and mean_share_false in addition to the difference between them to help readers understand the mechanism for these results.) 
*/

*DEVIATION: perfectly collinear, exclude Ds from controls

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store A

esttab A using OUTFILE.csv, cells(p) plain noobs title("Table1|mean_share_2conds") replace

reg mean_share_true nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store B

esttab B using OUTFILE.csv, cells(p) plain noobs title("Table1|mean_share_2conds") append

reg mean_share_false nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C

esttab C using OUTFILE.csv, cells(p) plain noobs title("Table1|mean_share_2conds") append

* Table 1 
estout B C A using "Tables/mean_share_2conds.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy Nudge & Affective Polarization

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust
est store A

esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC1|mean_share_2conds_prereg") append

reg mean_share_true nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust
est store B

esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC1|mean_share_2conds_prereg") append

reg mean_share_false nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust
est store C

esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC1|mean_share_2conds_prereg") append

* Table C1
estout B C A using "Tables/mean_share_2conds_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy Nudge & Affective Polarization

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if (SocialMedia_1==1 | SocialMedia_2==1) & SharingType_1==1, robust
est store A

esttab A using OUTFILE.csv, cells(p) plain noobs title("TableB5|mean_share_2conds_sharetype") append

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if (SocialMedia_1==1 | SocialMedia_2==1) & SharingType_2==1, robust
est store B

esttab B using OUTFILE.csv, cells(p) plain noobs title("TableB5|mean_share_2conds_sharetype") append

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if (SocialMedia_1==1 | SocialMedia_2==1) & SharingType_3==1, robust
est store C

esttab C using OUTFILE.csv, cells(p) plain noobs title("TableB5|mean_share_2conds_sharetype") append

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if (SocialMedia_1==1 | SocialMedia_2==1) & SharingType_4==1, robust
est store D

esttab D using OUTFILE.csv, cells(p) plain noobs title("TableB5|mean_share_2conds_sharetype") append

reg mean_share_diff nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if (SocialMedia_1==1 | SocialMedia_2==1) & SharingType_5==1, robust
est store E

esttab E using OUTFILE.csv, cells(p) plain noobs title("TableB5|mean_share_2conds_sharetype") append

*Table B5
estout A B C D E using "Tables/mean_share_2conds_sharetype.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005)
* Multicomparison check: Accuracy Nudge & Affective Polarization 

reg mean_share_diff_alt nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store A

esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD1|mean_share_2conds_robustness") append

reg mean_share_true nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store B

esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD1|mean_share_2conds_robustness") append

reg mean_share_false_alt nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store C

esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD1|mean_share_2conds_robustness") append

*TABLE D1
estout B C A using "Tables/mean_share_2conds_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy Nudge & Affective Polarization

label def nudgelab 0 "No accuracy prompt" 1 "Prompt" 
label val nudge nudgelab

label def affpollab 0 "Negative outpartisan experience" 1 "Positive outpartisan experience"
label val affpol affpollab

cibar mean_share_diff if deviation_twfb_political==1, over(nudge) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_diff_nudge.pdf", replace

cibar mean_share_diff if deviation_twfb_political==1, over(affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_diff_affpol.pdf", replace

cibar mean_share_true if deviation_twfb_political==1, over(nudge) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_nudge.pdf", replace

cibar mean_share_true if deviation_twfb_political==1, over(affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_affpol.pdf", replace

cibar mean_share_false if deviation_twfb_political==1, over(nudge) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_false_nudge.pdf", replace

cibar mean_share_false if deviation_twfb_political==1, over(affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_false_affpol.pdf", replace

/*
(We will use the same model for the manipulation checks.) 
Y = b0 + b1*nudge + b2*polarization + controls 
*/

reg acc_imp nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store A

esttab A using OUTFILE.csv, cells(p) plain noobs title("TableB2|manipchecks") append

reg affpol_people nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store B

esttab B using OUTFILE.csv, cells(p) plain noobs title("TableB2|manipchecks") append

reg affpol_pols nudge affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
est store C

esttab C using OUTFILE.csv, cells(p) plain noobs title("TableB2|manipchecks") append

*Table B2 
estout A B C using "Tables/manipchecks.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy Nudge & Positive Outpartisan Experience

su affpol_people affpol_pols

cibar acc_imp if deviation_twfb_political==1, over(nudge) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/acc_imp_nudge.pdf", replace

cibar affpol_people if deviation_twfb_political==1, over(affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/affpol_people_affpol.pdf", replace

cibar affpol_pols if deviation_twfb_political==1, over(affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2)  ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/affpol_pols_affpol.pdf", replace

/*
To test H3, we will estimate models of the form 

Y = b0 + b1*nudge + b2*polarization + b3*nudgeXpolarization + controls at the respondent level 

where the outcome variable is mean_share_diff. (We may also report separate results for mean_share_true and mean_share_false in addition to the difference between them to help readers understand the mechanism for these results.) We will also estimate the same model separately by content type. We would calculate mean_share_diff_congenial and mean_share_diff_uncongenial and estimate the model above separately for each. (Per above, we may also report separate results for mean_share_true_congenial, mean_share_false_congenial, mean_share_true_uncongenial, and mean_share_false_uncongenial in addition to the difference between each pairing to help readers understand the mechanism for these results.) 
*/

/* Initializing code to track pvalues of lincoms */
local lincom_term "1.nudge+1.nudge#1.affpol" // we want to capture p-value for 1.nudge+1.nudge#1.affpol

capture program drop pull_ps

program define pull_ps
	args linc_term
	
	local p_val = r(p)
	
	local csv_line = "`linc_term'" + "," + "`p_val'" + char(10)
	
	capture file close f
	file open f using OUTFILE.csv, write text append

	* Write the content of the local variable
	file write f "`csv_line'"

	* Close the file
	file close f	
end

*Model A
reg mean_share_diff nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("Table3|mean_share_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("Table3|mean_share_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("Table3|mean_share_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table 3
estout B C A using "Tables/mean_share_4conds.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
*Multicomparison check: Accuracy nudge, Positive outpartisan experience, Nudge x positive outpartisan, nudge effect: positive outpartisan

*Model A
reg mean_share_diff nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC3|mean_share_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC3|mean_share_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC3|mean_share_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table C3
estout B C A using "Tables/mean_share_4conds_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005)
* Multicomparison check: Accuracy nudge, Positive outpartisan experience, Nudge x positive outpartisan, nudge effect: positive outpartisan

*Model A
reg mean_share_diff_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD3|mean_share_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD3|mean_share_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD3|mean_share_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table D3
estout B C A using "Tables/mean_share_4conds_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, Positive outpartisan experience, Nudge x positive outpartisan, nudge effect: positive outpartisan

*Model A
reg mean_share_diff_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableB3(b)|mean_share_congenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableB3(b)|mean_share_congenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableB3(b)|mean_share_congenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table B3(b)
estout B C A using "Tables/mean_share_congenial_4conds.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, nudge x positive outpartisan, nudge effect: outpartisan experience 

*Model A
reg mean_share_diff_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC5(b)|mean_share_congenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC5(b)|mean_share_congenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC5(b)|mean_share_congenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table C5(b)
estout B C A using "Tables/mean_share_congenial_4conds_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, nudge x positive outpartisan, nudge effect: outpartisan experience 

*Model A
reg mean_share_diff_congenial_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD5(b)|mean_share_congenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_congenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD5(b)|mean_share_congenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_congenial_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD5(b)|mean_share_congenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table D5(b)
estout B C A using "Tables/mean_share_congenial_4conds_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, nudge x positive outpartisan, nudge effect: outpartisan experience 

*Model A
reg mean_share_diff_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableB3(a)|mean_share_uncongenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableB3(a)|mean_share_uncongenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableB3(a)|mean_share_uncongenial_4conds") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table B3(a)
estout B C A using "Tables/mean_share_uncongenial_4conds.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, nudge x positive outpartisan, nudge effect: polarized

*Model A
reg mean_share_diff_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC5(a)|mean_share_uncongenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC5(a)|mean_share_uncongenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC5(a)|mean_share_uncongenial_4conds_prereg") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table C5(a)
estout B C A using "Tables/mean_share_uncongenial_4conds_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, nudge x positive outpartisan, nudge effect: polarized

*Model A
reg mean_share_diff_uncongenial_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD5(a)|mean_share_uncongenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model B
reg mean_share_true_uncongenial nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD5(a)|mean_share_uncongenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Model C
reg mean_share_false_uncongenial_alt nudge##affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD5(a)|mean_share_uncongenial_4conds_robustness") append

lincom `lincom_term'
pull_ps `lincom_term'

*Table D5(a)
estout B C A using "Tables/mean_share_uncongenial_4conds_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

foreach var of varlist mean_share_true mean_share_false mean_share_true_congenial mean_share_false_congenial mean_share_true_uncongenial mean_share_false_uncongenial {
cibar `var' if deviation_twfb_political==1, over(nudge affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_4conds.pdf", replace
}

foreach var of varlist mean_share_diff mean_share_diff_congenial mean_share_diff_uncongenial {
cibar `var' if deviation_twfb_political==1, over(nudge affpol) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2)  ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_4conds.pdf", replace
}

/*
To test RQ1, we will estimate models of the following forms 

RQ1a: Y = b0 + b1*nudge + b2*not_strong_partisan + b3*strong_partisan + b4*nudgeXnot_strong_partisan + b4*nudgeXstrong_partisan + controls 

RQ1b: Y = b0 + b1*nudge + b2*medium_nfc + b3*high_nfc + b4*nudgeXmedium_nfc + b4*nudgeXhigh_nfc + controls 

at the respondent level where the outcome variable is mean_share_diff. (We may also report separate results for mean_share_true and mean_share_false in addition to the difference between them to help readers understand the mechanism for these results.) 
*/

local lincom_term1 = "1.nudge+1.nudge#1.not_strong_partisan"
local lincom_term2 = "1.nudge+1.nudge#1.strong_partisan"

*deviate to add polarization to model

*Model A
reg mean_share_diff nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("Table4(a)|mean_share_partisan_strength") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model B
reg mean_share_true nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("Table4(a)|mean_share_partisan_strength") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("Table4(a)|mean_share_partisan_strength") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Table 4a
estout B C A using "Tables/mean_share_partisan_strength.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, not strong partisan, nudge x not strong partisan, strong partisan, nudge x strong partisan, positive outpartisan experience, nudge effect: not strong partisans, nudge effect: strong partisans

*Model A
reg mean_share_diff nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model B
reg mean_share_true nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Table C4(a)
estout B C A using "Tables/mean_share_partisan_strength_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, not strong partisan, nudge x not strong partisan, strong partisan, nudge x strong partisan, positive outpartisan experience, nudge effect: not strong partisans, nudge effect: strong partisans

// * !! WHAT IS THIS  Writes over Table@ln923
// reg mean_share_diff nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
// lincom `lincom_term1' 
// lincom `lincom_term2' 
// est store A
//
// esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength") append
//
// reg mean_share_true nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
// lincom `lincom_term1' 
// lincom `lincom_term2' 
// est store B
//
// esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength") append
//
// reg mean_share_false nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust
// lincom `lincom_term1' 
// lincom `lincom_term2' 
// est store C
//
// esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC4(a)|mean_share_partisan_strength") append
//
// estout B C A using "Tables/mean_share_partisan_strength.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 

*Model A
reg mean_share_diff_alt nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD4(a)|mean_share_partisan_strength_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model B
reg mean_share_true nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD4(a)|mean_share_partisan_strength_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false_alt nudge##not_strong_partisan nudge##strong_partisan affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD4(a)|mean_share_partisan_strength_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

* Table D4(a)
estout B C A using "Tables/mean_share_partisan_strength_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, not strong partisan, nudge x not strong partisan, strong partisan, nudge x strong partisan, positive outpartisan experience, nudge effect: not strong partisans, nudge effect: strong partisans
 
gen partisan_type=.
replace partisan_type=0 if not_strong_partisan==0 & strong_partisan==0
replace partisan_type=1 if not_strong_partisan==1 & strong_partisan==0
replace partisan_type=2 if not_strong_partisan==0 & strong_partisan==1

label def partisan_type_lab 0 "Leaner" 1 "Not strong" 2 "Strong"
label val partisan_type partisan_type_lab

foreach var of varlist mean_share_true mean_share_false {
cibar `var' if deviation_twfb_political==1, over(nudge partisan_type) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_partisan_type.pdf", replace
}

foreach var of varlist mean_share_diff {
cibar `var' if deviation_twfb_political==1, over(nudge partisan_type) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_partisan_type.pdf", replace
}

*deviate to add polarization to model
local lincom_term1 = "1.nudge+1.nudge#1.medium_nfc"
local lincom_term2 = "1.nudge+1.nudge#1.high_nfc"

* Model A
reg mean_share_diff nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("Table4(b)|mean_share_nfc") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

* Model B
reg mean_share_true nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("Table4(b)|mean_share_nfc") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("Table4(b)|mean_share_nfc") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Table 4b
estout B C A using "Tables/mean_share_nfc.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, medium nfc, high nfc, nudge x medium nfc, high nfc, positive outpartisan experience, accuracy nudge effect: medium nfc, accuracy nudge effect: high nfc

*Model A
reg mean_share_diff nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableC4(b)|mean_share_nfc_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model B
reg mean_share_true nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableC4(b)|mean_share_nfc_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableC4(b)|mean_share_nfc_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Table C4(b) ** CHANGE LABEL **
estout B C A using "Tables/mean_share_nfc_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, medium nfc, high nfc, nudge x medium nfc, high nfc, positive outpartisan experience, accuracy nudge effect: medium nfc, accuracy nudge effect: high nfc

*Model A
reg mean_share_diff_alt nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("TableD4(b)|mean_share_nfc_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model B
reg mean_share_true nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("TableD4(b)|mean_share_nfc_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C
reg mean_share_false_alt nudge##medium_nfc nudge##high_nfc affpol male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("TableD4(b)|mean_share_nfc_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Table D4(b)
estout B C A using "Tables/mean_share_nfc_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, medium nfc, high nfc, nudge x medium nfc, high nfc, positive outpartisan experience, accuracy nudge effect: medium nfc, accuracy nudge effect: high nfc

label def nfc_terc_lab 1 "Low" 2 "Medium" 3 "High"
label val nfc_terc nfc_terc_lab

foreach var of varlist mean_share_true mean_share_false {
cibar `var' if deviation_twfb_political==1, over(nudge nfc_terc) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_nfc_terc.pdf", replace
}

foreach var of varlist mean_share_diff {
cibar `var' if deviation_twfb_political==1, over(nudge nfc_terc) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.7) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/`var'_nfc_terc.pdf", replace
}

*change data to respondent/content type level
/*
To test H2b, we will estimate a model of the form 

Y = b0 + b1*nudge + b2*polarization + b3*congenial + b4*polarizationXcongenial + controls 

where the data is at the respondent / content type level (congenial or uncongenial). For instance, respondent A would have one observation with mean_share_true, mean_share_false, and mean_share_diff for congenial headlines and one observation with the corresponding values of those variables for uncongenial headlines. We would then estimate the model above using mean_share_diff as the outcome variable. Standard errors will be clustered at the respondent level to account for dependence between those observations. (Per above, we may also report separate results for mean_share_true and mean_share_false in addition to the difference between them to help readers understand the mechanism for these results.) 
*/

/*
H3b:

Finally, to test the congenial/uncongenial difference directly, we will estimate a model of the form Y = b0 + b1*nudge + b2*polarization + b3*congenial + b4*nudgeXpolarization + b5*nudgeXcongenial + b6*polarizationXcongenial + b7*nudgeXpolarizationXcongenial + controls 

where the data is at the respondent / content type level (congenial or uncongenial). For instance, respondent A would have one observation with mean_share_true, mean_share_false, and mean_share_diff for congenial headlines and one observation with the corresponding values of those variables for uncongenial headlines. We would then estimate the model above using mean_share_diff as the outcome variable. Standard errors will be clustered at the respondent level to account for dependence between those observations. (Per above, we may also report separate results for mean_share_true and mean_share_false in addition to the difference between them to help readers understand the mechanism for these results.) 
*/

local lincom_term1 = "1.affpol+1.affpol#1.congenial"
local lincom_term2 = "1.congenial+1.affpol#1.congenial"
local lincom_terms = "1.nudge+1.nudge#1.affpol 1.nudge+1.nudge#1.congenial 1.affpol+1.affpol#1.congenial 1.nudge+1.nudge#1.congenial 1.nudge+1.nudge#1.congenial+1.affpol#1.congenial+1.nudge#1.affpol+1.nudge#1.affpol#1.congenial"

preserve
drop mean_share_diff 
rename mean_share_diff_congenial mean_share_diff1
rename mean_share_diff_uncongenial mean_share_diff2

reshape long mean_share_diff, i(Q832) j(order)
gen congenial=(order==1)

reg mean_share_diff congenial##republican##affpol if nudge==0 & deviation_twfb_political==1, robust

*Model A
reg mean_share_diff nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store A
esttab A using OUTFILE.csv, cells(p) plain noobs title("Table2|mean_share_congenial") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model Aalt
reg mean_share_diff nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, vce (cluster Q832)

est store Aalt
esttab Aalt using OUTFILE.csv, cells(p) plain noobs title("TableC2|mean_share_congenial_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'


label def congeniallab 0 "Uncongenial" 1 "Congenial"
label val congenial congeniallab

bysort congenial affpol: su mean_share_diff

cibar mean_share_diff if deviation_twfb_political==1, over(affpol congenial) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) ylab(,angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_diff_affpol_congenial.pdf", replace

*Model A1
reg mean_share_diff nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

est store A1
esttab A1 using OUTFILE.csv, cells(p) plain noobs title("TableB4|mean_share_congenial_3way") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

*Model A1alt
reg mean_share_diff nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust cluster(Q832)

est store A1alt
esttab A1alt using OUTFILE.csv, cells(p) plain noobs title("TableC6|mean_share_congenial_3way_prereg") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

restore

preserve
drop mean_share_diff mean_share_diff_alt
rename mean_share_diff_congenial_alt mean_share_diff1
rename mean_share_diff_uncongenial_alt mean_share_diff2

reshape long mean_share_diff, i(Q832) j(order)
gen congenial=(order==1)

*Model Aalt2
reg mean_share_diff nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store Aalt2
esttab Aalt2 using OUTFILE.csv, cells(p) plain noobs title("TableD2|mean_share_congenial_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model A1alt2
reg mean_share_diff nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

est store A1alt2
esttab A1alt2 using OUTFILE.csv, cells(p) plain noobs title("TableD6|mean_share_congenial_3way_robustness") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

restore

preserve
drop mean_share_true 
rename mean_share_true_congenial mean_share_true1
rename mean_share_true_uncongenial mean_share_true2

reshape long mean_share_true, i(Q832) j(order)
gen congenial=(order==1)

*Model B
reg mean_share_true nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store B
esttab B using OUTFILE.csv, cells(p) plain noobs title("Table2|mean_share_congenial") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model Balt
reg mean_share_true nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, vce (cluster Q832)

est store Balt
esttab Balt using OUTFILE.csv, cells(p) plain noobs title("TableC2|mean_share_congenial_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model Balt2
reg mean_share_true nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store Balt2
esttab Balt2 using OUTFILE.csv, cells(p) plain noobs title("TableD2|mean_share_congenial_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

label def congeniallab 0 "Uncongenial" 1 "Congenial"
label val congenial congeniallab

cibar mean_share_true if deviation_twfb_political==1, over(affpol congenial) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_affpol_congenial.pdf", replace

*Model B1
reg mean_share_true nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

est store B1
esttab B1 using OUTFILE.csv, cells(p) plain noobs title("TableB4|mean_share_congenial_3way") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

*Model B1alt
reg mean_share_true nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust cluster(Q832)

est store B1alt
esttab B1alt using OUTFILE.csv, cells(p) plain noobs title("TableC6|mean_share_congenial_3way_prereg") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

*Model B1alt2
reg mean_share_true nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

est store B1alt2
esttab B1alt2 using OUTFILE.csv, cells(p) plain noobs title("TableD6|mean_share_congenial_3way_robustness") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

restore

preserve
drop mean_share_false 
rename mean_share_false_congenial mean_share_false1
rename mean_share_false_uncongenial mean_share_false2

reshape long mean_share_false, i(Q832) j(order)
gen congenial=(order==1)

*Model C
reg mean_share_false nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store C
esttab C using OUTFILE.csv, cells(p) plain noobs title("Table2|mean_share_congenial") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'
 
*Model Calt
reg mean_share_false nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, vce (cluster Q832)

est store Calt
esttab Calt using OUTFILE.csv, cells(p) plain noobs title("TableC2|mean_share_congenial_prereg") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

label def congeniallab 0 "Uncongenial" 1 "Congenial"
label val congenial congeniallab

cibar mean_share_false if deviation_twfb_political==1, over(affpol congenial) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_false_affpol_congenial.pdf", replace

*Model C1
reg mean_share_false nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

est store C1
esttab C1 using OUTFILE.csv, cells(p) plain noobs title("TableB4|mean_share_congenial_3way") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

*Model C1alt
reg mean_share_false nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if prereg_include_social==1, robust cluster(Q832)

restore
est store C1alt
esttab C1alt using OUTFILE.csv, cells(p) plain noobs title("TableC6|mean_share_congenial_3way_prereg") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

preserve
drop mean_share_false mean_share_false_alt
rename mean_share_false_congenial_alt mean_share_false1
rename mean_share_false_uncongenial_alt mean_share_false2

reshape long mean_share_false, i(Q832) j(order)
gen congenial=(order==1)
tab congenial

*Model Calt2
reg mean_share_false nudge affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, vce (cluster Q832)

est store Calt2
esttab Calt2 using OUTFILE.csv, cells(p) plain noobs title("TableD2|mean_share_congenial_robustness") append

lincom `lincom_term1' 
pull_ps `lincom_term1'
lincom `lincom_term2'
pull_ps `lincom_term2'

*Model C1alt2
reg mean_share_false nudge##affpol##congenial male nonwhite college biden_approve republican age3544 age4554 age5564 age65plus use* share* if deviation_twfb_political==1, robust cluster(Q832)

restore
est store C1alt2
esttab C1alt2 using OUTFILE.csv, cells(p) plain noobs title("TableD6|mean_share_congenial_3way_robustness") append

foreach linc_term in `lincom_terms' {
	lincom `linc_term'
	pull_ps `linc_term'
}

*Table 2

estout B C A using "Tables/mean_share_congenial.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005)
* Multicomparison check: Congenial headline, positive outpartisan experience, positive outpartisan x congenial, accuracy nudge, congenial/uncongenial difference: positive outpartisan

*Table C2

estout Balt Calt Aalt using "Tables/mean_share_congenial_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Congenial headline, positive outpartisan experience, positive outpartisan x congenial, accuracy nudge, congenial/uncongenial difference: positive outpartisan

*Table D2

estout Balt2 Calt2 Aalt2 using "Tables/mean_share_congenial_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Congenial headline, positive outpartisan experience, positive outpartisan x congenial, accuracy nudge, congenial/uncongenial difference: positive outpartisan

*Table B4

estout B1 C1 A1 using "Tables/mean_share_congenial_3way.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, congenial headline, nudge x congenial, nudge x positive outpartisan, affective polarization x congenial, nudge x positive outpartisan x congenial

*Table C6

estout B1alt C1alt A1alt using "Tables/mean_share_congenial_3way_prereg.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, congenial headline, nudge x congenial, nudge x positive outpartisan, affective polarization x congenial, nudge x positive outpartisan x congenial

*Table D6

estout B1alt2 C1alt2 A1alt2 using "Tables/mean_share_congenial_3way_robustness.tex", label style(tex) replace varwidth(25) collabels("") cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) stats(N, fmt(%9.0f) labels("N")) starlevels(* 0.05 ** 0.01 *** 0.005) 
* Multicomparison check: Accuracy nudge, positive outpartisan experience, congenial headline, nudge x congenial, nudge x positive outpartisan, affective polarization x congenial, nudge x positive outpartisan x congenial

*altered figure approach

preserve
rename mean_share_true mean_share1
rename mean_share_false mean_share2

reshape long mean_share, i(Q832) j(order)
gen true=(order==1)

label def truelab 0 "False" 1 "True"
label val true truelab

cibar mean_share if deviation_twfb_political==1, over(nudge true) gap(100) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_false_nudge.pdf", replace

cibar mean_share if deviation_twfb_political==1, over(affpol true) gap(100) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_false_affpol.pdf", replace

cibar mean_share if deviation_twfb_political==1, over(partisan_type true) gap(100) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_false_partisan_type.pdf", replace

cibar mean_share if deviation_twfb_political==1, over(nfc_terc true) gap(100) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*1) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_false_nfc_terc.pdf", replace
restore

preserve
rename mean_share_true_congenial mean_share1
rename mean_share_false_congenial mean_share2
rename mean_share_true_uncongenial mean_share3
rename mean_share_false_uncongenial mean_share4

reshape long mean_share, i(Q832) j(order)
gen true=(order==1 | order==3)
gen congenial=(order<3)

label def truelab 0 "False" 1 "True"
label val true truelab

label def congeniallab 0 "Uncongenial" 1 "Congenial"
label val congenial congeniallab

cibar mean_share if deviation_twfb_political==1, over(affpol congenial true) gap(100) ciopts(lcolor(gs6)) graphopts(graphregion(fcolor(white) ifcolor(none)) plotregion(fcolor(none) lcolor(white) ifcolor(none) ilcolor(none)) legend(cols(3) pos(6) size(*.85) region(lpattern(solid) lcolor(black))) ytitle("") scheme(lean2) yscale(r(1 6.01)) ylab(1 "Extremely unlikely" 2 "Moderately unlikely" 3 "Slightly unlikely" 4 "Slightly likely" 5 "Moderately likely" 6 "Extremely likely",angle(0) grid glcolor(gs3)))
graph export "Figures/mean_share_true_false_affpol_congenial.pdf", replace
restore

/*Other notes: 
-The models above are estimated at the respondent level but we may instead estimate equivalent models at the headline level for presentational reasons or if it is necessary to test a preregistered hypothesis. 
-We may compute effect sizes on binary outcome variables (0=extremely/moderately/slightly unlikely to share, 1=slightly/moderately/extremely likely to share) to illustrate substantive effects 
-We will compute and report appropriate auxiliary quantities from our models to test the hypotheses of interest, including marginal effects appropriate to test the hypotheses of interest from the models including interaction terms, treatment effects by subgroup, and differences in marginal effects between subgroups. 
-In some cases, we may present treatment effects estimated on different subsets of the data for expositional clarity. If so, we will verify that we can reject the null of no difference in treatment effects in a more complex interactive model reported in an appendix when possible. 
-We will compute and report summary statistics for our sample. We may also collect and may report response timing data as a proxy for respondent attention. 
-The order of hypotheses and analyses in the final manuscript may be altered for expositional clarity. 
-Regression results for any individual ordered dependent variables we analyze will be verified for robust using ordered probit if appropriate.*/

log close
